package com.lianyi.login.di.module;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.jess.arms.di.scope.ActivityScope;

import dagger.Module;
import dagger.Provides;

import com.lianyi.login.mvp.contract.DoctorListContract;
import com.lianyi.login.mvp.model.DoctorListModel;
import com.lianyi.login.mvp.model.entity.DoctorListBean;
import com.lianyi.login.mvp.ui.adapter.DoctorListAdapter;
import com.lianyi.module_login.R;

import java.util.ArrayList;
import java.util.List;


@Module
public class DoctorListModule {
    private DoctorListContract.View view;

    /**
     * 构建DoctorListModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
     *
     * @param view
     */
    public DoctorListModule(DoctorListContract.View view) {
        this.view = view;
    }

    @ActivityScope
    @Provides
    DoctorListContract.View provideDoctorListView() {
        return this.view;
    }

    @ActivityScope
    @Provides
    DoctorListContract.Model provideDoctorListModel(DoctorListModel model) {
        return model;
    }

    @ActivityScope
    @Provides
    RecyclerView.LayoutManager provideLayoutManager() {
        return new LinearLayoutManager(view.getActivity());
    }

    @ActivityScope
    @Provides
    List<DoctorListBean> provideUserList() {
        return new ArrayList<>();
    }

    @ActivityScope
    @Provides
    RecyclerView.Adapter provideDoctorListAdapter(List<DoctorListBean> list) {
        return new DoctorListAdapter(R.layout.login_doctor_recycle_list, list);
    }
}